<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title></title>
    <script src="js/react.js" charset="utf-8"></script>
    <script src="js/react-dom.js" charset="utf-8"></script>
    <script src="js/browser.js" charset="utf-8"></script>
    <script type="text/babel">
    class Comp extends React.Component{
      constructor(...args){
        super(...args);  //超类、父类
        this.state={value: ''};
      }

      fn(ev){
        this.setState({
          value: ev.target.value
        });
      }

      render(){
        return <div>
          <input type="text" onChange={this.fn.bind(this)} />
          <span>{this.state.value}</span>
        </div>;
      }
    }

    window.onload=function (){
      var oDiv=document.getElementById('div1');

      ReactDOM.render(
        <Comp/>,
        oDiv
      );
    };
    </script>
  </head>
  <body>
    <div id="div1">

    </div>
  </body>
</html>
